<?php

declare(strict_types=1);

namespace App\Resource\Activity\NewUserGift\Task;

use App\Enums\ActivityEnum;
use Illuminate\Http\Resources\Json\JsonResource;

class Resource extends JsonResource
{
    public function toArray($request)
    {
        $this->rewards = RewardResource::collection($this->rewards);
        return [
            'id'             => $this->id ?? null,
            'gift_value'     => $this->gift_value ?? null,
            'money'          => $this->money ?? null,
            'receive_status' => $this->receive_status ?? ActivityEnum::RECEIVE_STATUS_NO,
            'rewards'        => $this->rewards ?? null,
        ];
    }
}
